import React, { Component } from 'react';
import { Swiper } from 'antd-mobile'
// import PropTypes from 'prop-types'
import "../styles/MySwiper.css"

class MySwiper extends Component {
    constructor(props){
        super(props);
        this.state = {}
        // this.state = {
        //     swiperlist:[
        //         {
        //             pic:'',
        //             link:''
        //         },
        //         {
        //             pic:'',
        //             link:''
        //         },
        //         {
        //             pic:'',
        //             link:''
        //         },
        //     ]
        // }
    }
    render() {
        return (
            <div className='myswiper'>
                <Swiper loop autoplay autoplayInterval={1000}>
                    {
                        this.props.swiperlist.map((item,index)=>{
                            return (
                                <Swiper.Item key={index}>
                                    <img src={item.pic} alt="" />
                                </Swiper.Item>
                            )
                        })
                    }
                </Swiper>
            </div>
        );
    }
}

//类型验证
// MySwiper.propTypes = {
//     swiperlist:{ type: PropTypes.array, default:[] }
// }

export default MySwiper;